<?php
class SF_CategoryPage_ClassificationController extends Mage_Core_Controller_Front_Action{
    public function indexAction(){
        $title = $this->listIds();
        $this->loadLayout();
        $this->getLayout()->getBlock('head')->setTitle($this->__($title));
        $this->renderLayout();
    }

    public function listIds(){ //一级分类ID
        $codeId  = $this->getRequest()->getParam("code");
        $category = Mage::getModel('catalog/category')->load($codeId);
        $title = $category->getName();
        //$codeIds = $this->codeIds();
        $codeIds = array('1066','1067','537','586','6','792','726' ,'1068' ,'394','484',);
        if (in_array($codeId, $codeIds)) {
            return $title;
        }else{
            $this->_redirect('/');
        }

    }
    public function codeIds(){ //一级分类ID
        $root = Mage::getModel('catalog/category')->load('2');
        $subCat = explode(',',$root->getChildren());
        $collection  = $root
            ->getCollection()
            ->addAttributeToSelect("*")
            ->addFieldToFilter("entity_id", array("in", $subCat) );
        $codeObj = array();
        foreach($collection as $catid){
            $codeObj[] = $catid->getId();
        }
        return $codeObj;
    }
}